﻿using System.Collections.ObjectModel;
using System.Xml.Serialization;
using PrearrangedChaos.AgileZen.Service.Rest;

namespace PrearrangedChaos.AgileZen.Service.Model
{
    /// <remarks/>
    [XmlType(AnonymousType = true)]
    [XmlRootAttribute(ElementName = "tag", Namespace = "", IsNullable = false)]
    [ZenRestRequest("projects/{ProjectId}/tags/{TagId}", "projects/{ProjectId}/tags")]
    public partial class Tag : TagUpdater, ITag
    {
        private IStory[] _stories;

        [XmlArrayItemAttribute("story", IsNullable = false)]
        [XmlArray(ElementName = "stories")]
        public Story[] StoriesXmlElement
        {
            get { return _stories as Story[]; }
            set { _stories = value; }
        }

        [XmlIgnore]
        public ReadOnlyCollection<IStory> Stories
        {
            get { return new ReadOnlyCollection<IStory>(_stories ?? new Story[0]); }
        }

        public bool StoriesXmlElementSpecified { get { return false; } }
    }
}